Chris Pollett > Old Classes > CS174
( Print View )

Student Corner:
  [Submit Sec1]
  [Grades Sec1]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Description]
  [Course Outcomes]
  [Outcomes Matrix]
  [Course Schedule]
  [Grading]
  [Requirements/HW/Quizzes]
  [Class Protocols]
  [Exam Info]
  [Regrades]
  [University Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#3 --- last modified February 06 2019 04:05:05..

Solution set.

Due date: Apr 10

Files to be submitted:
  Hw3.zip

Purpose: To write an application that uses databases and uses the MVA design pattern

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO3 -- Write server-side scripts that process HTML forms.

CLO5 -- Develop and deploy web applications that involve components, web services, and databases.

Specification:

For this homework you will write an app Note-a-List that allows users to post categorized messages/classified listings. Here are some mock-ups of how the site should look:

Landing Page
A Sublist Page.

Note-A-List/For Sale

New List Page.

Note-A-List/For Sale

New Note

:
New Note Page.

Note-A-List/For Sale

Note: Timeless Watch

Waltham Model 1857 Pocket Watch, American Watch Company. In good condition, still runs. $800 obo. Call (408) 555-5555.
Display Note Page
Here are the requirements for your project:
  1. Your Hw3.zip folder has a readme.txt file with all the names and ids for your group.
  2. All the web pages you output validate as XHTML 5.
  3. Your project is written using namespaces. You only create variables, arrays, objects, define new classes, etc. in the namespace cool_name_for_your_group\hw3 and subnamespaces thereof.
  4. Your project directory structure and urls that are linked to by your project are as follows:
    index.php -- entry point into your project. No other file in your project is directly linked-to.
        All urls used as links by your project is in the format:
        BASE_URL/index.php?c=name_of_controller&m=name_of_method&arg1=value_for_arg1& ...&argn=value_for_argn 
    src
     |-configs |- Config.php contains a class with constants for things like 
     |         |       database user, password, host, port, etc. Basically, 
     |         |       it should have anything you think the grader might need
     |         |       to get your program running on the grader's machine.
     |         |- CreateDB.php can be run from the command-line to make a good initial
     |                database.
     |-controllers -- contains all the controller classes you write, one per file
     |-models -- contains all the model classes you write, one per file
     |-resources -- contains any resources used by your app such as images
     |-styles -- has any external stylesheets you need
     |-views -- contains all the view classes you write, one per file
          |-elements -- contains all the element classes you write, one per file
          |-helpers -- contains all the helper classes you write, one per file
          |-layouts -- contains all the helper classes you write, one per file    
    
  5. Typing php CreateDb.php while in a shell in the configs folder creates an initial Mysql Database with tables created in BCNF. The tables' schemas is reasonable for storing and retrieving any data similar to that given in the mock-up views above.
  6. Your project defines base classes: Controller, Model, View, Element, and Helper. The namespaces for these and their subclasses should be respectively: cool_name_for_your_group\hw3\controllers, cool_name_for_your_group\hw3\models, cool_name_for_your_group\hw3\views, cool_name_for_your_group\hw3\views\elements, and cool_name_for_your_group\hw3\views\helpers.
  7. Your project uses the Model View Adapter pattern that we have discussed in class. This item is for overall how well you succeeded at this. What this means for particular classes will be described in the next several points.
  8. Only controller classes directly handle request/form data. Controllers use this information to invoke model methods that make database calls to get/set/update info in the database, then choose a view, instantiate it, and call its render() method to display a web page back to the requesting browser.
  9. Only subclasses of Model interact with the database. The base Model class has methods for performing the initial connection to the database. Model classes have methods to marshal a particular kind of object from one or more tables, and to take already created objects and unmarshal them persistently into the database.
  10. Only subclasses of View, Element, Helper, Layout are allowed to render HTML. Each view is used to render a particular kind of whole web page. Elements are used to render a particular portion of a web page that might occur on several kinds of web pages (for example, a navigation block). Helpers have methods which make it easy to output the HTML for particular kinds of widgets (say a method that takes an array and uses it to outut the HTML for a dropdown with the elements coming from the array). Layouts are used to output common header and footer HTML that might be used by several views.
  11. On the Landing page and sublist page, List links take one to the page of the appropriate sublist (for a link on a sublist page to the appropriate sub sub list, for a link on a sub sub list to the appropriate sub sub sub list, etc.).
  12. Note links take one to the appropriate Display Note page.
  13. Next to note links is the date on which that note was created.
  14. The main landing page corresponds to viewing the root list. Other than the root list each list has a parent list, which is the list that the New List link was clicked on to create it.
  15. On a sublist page, etc., if the nesting of lists is too great then the main heading is of the form: Note-A-List/../Parent List/Current List.
  16. Links on each pages main heading take one to the appropriate list. I.e., in Note-A-List/../Parent List/Current List, the Note-A-List link takes on to the landing page, the Parent List link takes one to the parent sublist page, and the Current List link points to the current page.
  17. Notes are listed from newest to oldest, categories are listed in alphabetical order. Sorting is done at the database query level, not after the data is retrieved.
  18. The New List page allows a sub list to be added to the current list. If the name is blank, or sanitizes using filter_var to blank no new list is added. In both cases, after the action is performed the current list page is shown.
  19. The New Note page allows a new note to be added to the current list. If either field is blank, or sanitizes using filter_var to blank no new note is added. In both cases, after the action is performed the current list page is shown.
  20. The Display Note page shows a previously created note as illustrated in the mock-ups above.

Point Breakdown

Items (a)-(t) are each worth (1/2pt). If an item involves several sentences, then all of the sentences must be accomplished to receive the 1/2 pt. 10pts
Total10pts